﻿using System;
using System.Linq;
using Microsoft.International.Converters.PinYinConverter;

namespace InsightAuto.Web
{
    public class Utility
    {
        public static char FirstPinyinCharOf(string chinese)
        {
            if (string.IsNullOrEmpty(chinese))
                throw new ArgumentException();

            char first = chinese.First();
            ChineseChar cc = new ChineseChar(first);
            if (cc.PinyinCount > 0)
            {
                return cc.Pinyins.First().ToUpper().FirstOrDefault();
            }

            //throw new InvalidOperationException("无法转换拼音");
            return 'A';

        }

    }
}